var ns;
var app = new Vue({
    el: '#app',
    data: {
        issuccess: false,
        ID: '',
        msg: '',
    },
    methods: {
        get_data: function() {
            var that = this;
            ns.post({
                action: 'docheckqrcodestatus',
                ID: that.ID
            }, function(succeed, data, err) {
                if (succeed) {
                    that.issuccess = true;
                    that.msg = '您正在使用APP扫码登录后台，确认登录?';
                } else if (err) {
                    that.msg = err;
                }
            });
        },
        do_confirm: function() {
            var that = this;
            ns.post({
                action: 'confirmqrcodelogin',
                ID: that.ID
            }, function(succeed, data, err) {
                if (succeed) {
                    api.toast({
                        msg: '登录成功',
                        duration: 2000,
                        location: 'bottom'
                    });
                    setTimeout(function() {
                        api.closeWin();
                    }, 1000)
                } else if (err) {
                    msg = err;
                }
            });
        },
    }
});
apiready = function() {
    api.parseTapmode();
    app.ID = api.pageParam.id || 0; //二维码传值
    ns = window.Foresight.Util;
    app.get_data();
    setTimeout(function() {
        api.closeFrame({
            name: 'scanner_frm'
        });
    }, 500);
}
